<extend name="Public/base"/>

<block name="style">
    <link href="__STATIC__/select2/select2.css" rel="stylesheet" type="text/css"></link>
    <link href="__STATIC__/select2/select2-bootstrap.css" rel="stylesheet" type="text/css"></link>
    <script src="__STATIC__/select2/select2.js"></script>
    <style>
        .hero-unit h1{
            font-size: 45px;
            margin-bottom: 45px
        }
        .hero-unit p{
            line-height: 1.8em;
            margin-top: 15px;
        }
        .hero-unit .btn-group{
            margin:35px 0;
        }
    </style>
</block>
<block name="body">

    <if condition="$_list eq null">
        <div class="container">
            <div class="row">
                <div class="hero-unit">
                    <h1>抱歉，暂时没有图片素材</h1>
                    <p>您可以在下面新增图片素材，或者从微信导入</p>

                    <p class="btn-group">
                        <a href="{:U('WechatMaterial/online',array('type'=>'picture'))}" class="btn btn-success btn-large">从微信导入</a>
                        <a href="{:U('addPicture')}"  class="btn btn-primary btn-large">新增图片</a>
                    </p>
                </div>
            </div>
        </div>
        <else />
        <div class="container">
            <div class="row">
                <ul class="thumbnails">
                    <volist name="_list" id="vo">
                        <li class="span3">
                            <a href="#picModal" class="thumbnail previewPic" role="button" data-path="{:get_cover($vo['file_id'],'path')}" data-toggle="modal">
                                <img src="{:get_cover($vo['file_id'],'path')}" alt="{$vo.media_id}"/>
                            </a>

                            <div class="mass_box" style="margin-top: 15px">
                                <p class="btn-group">
                                <a href="{:U('deletePicture?id='.$vo['id'])}" class="btn btn-warning confirm ajax-get">删除</a>
                                <a href="#massPreviewModal" class="btn btn-default previewMeterial" role="button" data-id="{$vo.media_id}" data-type="image" data-path="{:get_cover($vo['file_id'],'path')}" data-toggle="modal">预览</a>
                                <a href="#massMessageModal" class="btn btn-danger massMeterial" role="button" data-id="{$vo.media_id}" data-type="image" data-path="{:get_cover($vo['file_id'],'path')}" data-toggle="modal">群发</a>
                                </p>
                            </div>
                        </li>
                    </volist>
                </ul>
            </div>
            <div class="row">
                <div class="span12">
                    <p>您可以在下面新增图片素材，或者从微信导入</p>

                    <p class="btn-group">
                        <a href="{:U('WechatMaterial/online',array('type'=>'picture'))}" class="btn btn-success btn-large">从微信导入</a>
                        <a href="{:U('addPicture')}"  class="btn btn-primary btn-large">新增图片</a>
                    </p>
                </div>
            </div>
        </div>

    </if>
    {$page}
    <!-- picModal -->
    <div id="picModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="picModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="picModalLabel">预览图片</h3>
        </div>
        <div class="modal-body">
            <p>预览图片…</p>
        </div>
        <div class="modal-footer">
            <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
        </div>
    </div>
    <include file="WechatMass/massjs" />
</block>

<block name="script">
    <script type="text/javascript">
        $("a.previewPic").click(function(){
            var str = "<img src='" + $(this).attr('data-path') + "' >";
            $("#picModal").find(".modal-body").empty().append(str);
        });
    </script>

</block>